package net.tngou.crawler.action;

import java.io.IOException;

import javax.servlet.ServletException;

import org.apache.commons.lang3.math.NumberUtils;

import net.tngou.crawler.enums.StateEnum;
import net.tngou.crawler.enums.TypeEnum;
import net.tngou.crawler.jdbc.PageUtil;
import net.tngou.crawler.pojo.Data;
import net.tngou.crawler.pojo.POJO;
import net.tngou.crawler.service.DataService;


/**
 * 数据
 * @author tngou@tngou.net
 *
 */
public class DataAction extends BaseAction {

	@Override
	public void execute() throws ServletException, IOException {
		DataService service = new DataService();
		int  state=2;
		String[] rs = request.getParams();
		if(rs!=null&&rs.length>0&&NumberUtils.isNumber(rs[0]))
			state=Integer.parseInt(rs[0]);
		PageUtil page = service.getPage(ask.getPage(), ask.getRows(),state);
		root.put("page", page);
		root.put("state", state);
		root.put("states", StateEnum.values());
		printFreemarker("data.ftl", root);
		
	}
}
